// 客户相关类型定义

// 客户类型枚举
export enum CustomerType {
    Individual = 'Individual',    // 个人
    Enterprise = 'Enterprise'     // 企业
}

// 客户状态枚举
export enum CustomerStatus {
    Active = 'Active',           // 活跃
    Inactive = 'Inactive',       // 非活跃
    Blacklisted = 'Blacklisted'  // 黑名单
}

// 信用等级枚举
export enum CreditRating {
    A = 'A',  // A级
    B = 'B',  // B级
    C = 'C',  // C级
    D = 'D'   // D级
}

// 基础客户实体
export interface Customer {
    id: number
    customerNumber: string
    customerName: string
    companyName: string
    customerType: CustomerType
    customerStatus: CustomerStatus
    partnerLevelId?: number
    partnerCategoryId?: number
    salesRepresentativeId?: number
    industryId?: number
    businessNatureId?: number
    locationId?: number
    creditLimit: number
    creditRating: CreditRating
    paymentTerms?: string
    unifiedSocialCreditCode?: string
    phoneNumber?: string
    faxNumber?: string
    email?: string
    website?: string
    companyAddress?: string
    remarks?: string
    isEnabled: boolean
    createTime: string
    modifyTime?: string
}

// 客户DTO（用于列表显示）
export interface CustomerDto extends Customer {
    customerLevelName?: string
    customerCategoryName?: string
    salesRepresentativeName?: string
    businessNatureName?: string
    industryName?: string
    locationName?: string
    createdAt: string
    updatedAt: string
}

// 客户详情DTO
export interface CustomerDetailDto extends CustomerDto {
    contacts?: CustomerContact[]
    bankAccounts?: CustomerBankAccount[]
}

// 客户联系人
export interface CustomerContact {
    id: number
    customerId: number
    contactName: string
    position?: string
    phoneNumber?: string
    email?: string
    isPrimary: boolean
    remarks?: string
}

// 客户银行账户
export interface CustomerBankAccount {
    id: number
    customerId: number
    bankName: string
    accountNumber: string
    accountHolder: string
    accountType?: string
    remarks?: string
}

// 新增客户命令
export interface CreateCustomerCommand {
    customerName: string
    companyName: string
    customerType: CustomerType
    customerStatus: CustomerStatus
    partnerLevelId?: number
    partnerCategoryId?: number
    salesRepresentativeId?: number
    industryId?: number
    businessNatureId?: number
    locationId?: number
    creditLimit: number
    creditRating: CreditRating
    paymentTerms?: string
    unifiedSocialCreditCode?: string
    phoneNumber?: string
    faxNumber?: string
    email?: string
    website?: string
    companyAddress?: string
    remarks?: string
    isEnabled: boolean
}

// 更新客户命令
export interface UpdateCustomerCommand extends CreateCustomerCommand {
    id: number
}

// 删除客户命令
export interface DeleteCustomerCommand {
    id: number
}

// 获取客户列表查询参数
export interface GetCustomerListQuery {
    pageIndex: number
    pageSize: number
}

// 获取客户详情查询
export interface GetCustomerByIdQuery {
    id: number
}

// 分页参数
export interface PaginationParams {
    currentPage: number
    pageSize: number
    total: number
}

// API响应结果
export interface APIResult<T> {
    code: number
    message: string
    data: T
}

// 分页API响应结果
export interface APIPageing<T> {
    data: T[]
    totalCount: number
    pageIndex: number
    pageSize: number
    totalPages: number
}

// 客户列表API响应
export interface CustomerListResponse {
    code: number
    message: string
    data: APIPageing<CustomerDto[]>
}

// 客户详情API响应
export interface CustomerDetailResponse {
    code: number
    message: string
    data: CustomerDetailDto
}

// 操作结果API响应
export interface OperationResultResponse {
    code: number
    message: string
    data: boolean
}

// 新增客户API响应
export interface CreateCustomerResponse {
    code: number
    message: string
    data: number  // 返回客户ID
} 